﻿Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.Views.Base

Public Class Form_LosingRow

    Private Sub BacsiBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles BacsiBindingNavigatorSaveItem.Click
        Me.NhapchitietTableAdapter.Update(Me.PcvgppDataSet.nhapchitiet)

    End Sub

    Private Sub Form_LosingRow_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'PcvgppDataSet.nhapchitiet' table. You can move, or remove it, as needed.
        Me.NhapchitietTableAdapter.Fill(Me.PcvgppDataSet.nhapchitiet)
        'TODO: This line of code loads data into the 'PcvgppDataSet.nhap' table. You can move, or remove it, as needed.
        Me.NhapTableAdapter.Fill(Me.PcvgppDataSet.nhap)
        'TODO: This line of code loads data into the 'PcvgppDataSet.bacsi' table. You can move, or remove it, as needed.
        Me.BacsiTableAdapter.Fill(Me.PcvgppDataSet.bacsi)
        Me.GridView1.OptionsBehavior.Editable = True
        Me.GridView1.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True
        Me.GridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom

    End Sub

    Private Sub MaTextEdit_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles MaTextEdit.KeyDown
        Me.GridView1.AddNewRow()
        Dim col As GridColumn = GridView1.Columns("ma")
        'Me.GridView1.FocusedRowHandle = Me.GridView1.RowCount - 1
        Me.GridView1.MoveLast()
        Me.GridView1.FocusedColumn = col
        GridView1.ShowEditor()

    End Sub

    Private Sub GridView1_InitNewRow(sender As Object, e As DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs) Handles GridView1.InitNewRow
        Dim View As ColumnView = sender
        View.SetRowCellValue(e.RowHandle, View.Columns("ma"), Me.MaTextEdit.EditValue)
    End Sub

    Private Sub GridView1_InvalidRowException(sender As Object, e As DevExpress.XtraGrid.Views.Base.InvalidRowExceptionEventArgs) Handles GridView1.InvalidRowException
        e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction
    End Sub
End Class